package com.zushiye.order.controller;


import com.zushiye.order.model.response.CateListResponse;
import com.zushiye.order.service.JsonFileReadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;


@RestController
@RequestMapping("/cate_list")
public class CateListController {

    @Autowired
    private JsonFileReadService service;

    //http://127.0.0.1:8080/cate_list/get
    @GetMapping(value = "/get")
    public CateListResponse login() {
        try {
            CateListResponse res = service.readJsonFile("cate_list.json", CateListResponse.class);
            return res;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return new CateListResponse();
    }


}
